<%@page import="dto.companyFormDTO"%>
<%@page import="vo.companyFormVO"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src = '../js/company_form.js'></script>
<link rel="stylesheet" href="../css/company_form.css">
<title>Insert title here</title>
</head>
<body>
<jsp:useBean id="vo" class="vo.companyFormVO" scope="page"/>
<jsp:setProperty property="*" name="vo"/>
<%
	String m_id = (String) session.getAttribute("sessionMid");
	
	
	companyFormVO cvo = vo;
	cvo.setM_id(m_id);
	
	companyFormDTO cdto = new companyFormDTO();
	cvo = cdto.find_number(cvo);
	cdto.voSet(cvo);
	ArrayList<companyFormVO> al = cdto.list();
	

%>
<form name="frm" method="post">
	<input type="hidden" name="nowPage"  />

	<input type="hidden" name="form_number" value="<%=cvo.getForm_number() %>" />
	<input type='hidden' name="c_form_number"  value="<%=cvo.getC_form_number()%>" />

	<input type='hidden' name="c_draft_date" value="<%=cvo.getC_draft_date()%>" />
	
	<input type='hidden' name=c_form_type value="<%=cvo.getC_form_type()%>"/>
	
	<input type="hidden" name="c_draft_title" value="<%=cvo.getC_draft_title() %>" />
	
	<input type='hidden' name="e_name" value="<%=cvo.getE_name()%>"/>
	<input type='hidden' name="e_position" value="<%=cvo.getE_position()%>"/>
	<input type='hidden' name="e_number" value="<%=cvo.getE_number()%>"/>
	
	<input type='hidden' name="c_draft_done" value="<%=cvo.getC_draft_done()%>"/>
</form>

<div id = 'wrab'>
	<p/>
	<div id = 'form_list_title'>
		<div class='form_list_number'>기안 번호</div>
		<div class='form_list_draft_date'>작성 날자</div>
		<div class='form_list_draft_type'>신청 구분</div>
		<div class='form_list_title'>제&nbsp;&nbsp;&nbsp;&nbsp;목</div>
		<div class='form_list_name'>작성자</div>
		<div class='form_list_view'>진행 상황</div>
	</div>


<%
	int length_is = 0;
	for(int i=0; i<al.size(); i++){
		length_is = String.valueOf(al.get(i).getForm_number()).length();
%>
	<div id = 'form_list_items'>
		<div class='form_list_number'><%=al.get(i).getC_form_number()%>-
		<%for(int j = length_is; j< 5; j++){%>0<%}out.print(al.get(i).getForm_number());%>
		</div>
		<div class='form_list_draft_date'><%=al.get(i).getC_draft_date()%></div>
		<div class='form_list_draft_type'>
			<%switch(al.get(i).getC_form_type()){
			case 1:
				out.print("결제 요청");
				break;
			case 2:
				out.print("업무 이관");
				break;
			case 3:
				out.print("기획서");
				break;
			case 4:
				out.print("구매 이력서");
				break;
			default:
				out.print("오류");
				break;
			}
			%>
		</div>
		<div class='form_list_title'>
		<a href="#" onclick="open_popup(<%=al.get(i).getForm_number()%>)"><%=al.get(i).getC_draft_title() %></a>
		</div>
		<div class='form_list_name'><%=al.get(i).getE_name()%> <%=al.get(i).getE_position()%></div>
		<div class='form_list_view'>
		<%if(al.get(i).getC_draft_done() == 0){
			out.print("진행중");
		}else{
			out.print("완료");
		}%></div>
	</div>
<%}%>
</div>

<div id = 'list_page' align="center">
			<% if(cdto.getNowPage()==1){%>
			[처음으로]
			<%}else{%><a href='#' onclick='go_page(1)'>[처음으로]  </a>
			<%}%>
			
		<% if(cdto.getNowBlock()==1){%>
			[이전으로]
			<%}else{%><a href="#" onclick='go_page(<%=cdto.getStartPage()-1 %>)'> [이전으로] </a>
			<%} %>	
		<%	
		int i=0;
		for(i = cdto.getStartPage(); i<=cdto.getEndPage(); i++){%>
		<a href= "#" onclick = "go_page(<%= i %>)"><%= i %></a>
		<%} %>
		<% if(cdto.getNowBlock()==cdto.getTotBlock()){%>
			[다음으로]
			<%}else{%><a href= '#' onclick = "go_page(<%=i %>)">  [다음으로] </a>
			<%} %>
		
		<% if(cdto.getNowPage()==cdto.getTotPage()){%>
			[맨끝으로]
			<%}else{%><a href= "#" onclick = "go_page(<%=cdto.getTotPage() %>)">  [맨끝으로] </a>
		<%} %>	
</div>
	
</body>
</html>